#ifndef __Alert_Log_
#define __Alert_Log_

#include <stdbool.h>

#ifdef __cplusplus
extern "C"
{
#endif

#define DEVELOP_MODE_DEBUG             "debug"              //调试模式
#define DEVELOP_MODE_RELEASE           "release"            //发布模式
#define MAX_FILE_SIZE                  3145728              //日志文件最大值，3 * 1024 * 1024  
#define MAX_FILE_COUNT                 10                   //备份日志文件最多存储多少个

#ifndef sos_free
#define sos_free(ptr) sos_safe_free(ptr);ptr=NULL
#endif

typedef struct{
    char logDir[256];
    char logFileName[64];
    char developMode[16];
    int outputToFile;
    long maxFileSize;
    int maxFileCount;
}ControllParams;

void *sos_malloc(size_t size, const char *tag);
void sos_safe_free(void *data);

int initLogMoudle(ControllParams *controllParams);

void toggleWirteToLocal(int isOpen);

void setDevelopMode(const char *mode);

void log_d(const char *formate, ...);

void log_i(const char *formate, ...);

void log_w(const char *formate, ...);

void log_e(const char *formate, ...);

void compressCurrentLogFile();

void getCompressName(char *compressName, const char *preName);
void uploadLog(const char *tag, const char *licenseId);
int hasCrashLog(const char *crashTagPath);

int needDelayWriteLog();

#ifdef __cplusplus
}
#endif

#endif